<html>
<head><meta charset="utf-8"><title>Issue 79497 · rustdoc · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/index.html">rustdoc</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/Issue.2079497.html">Issue 79497</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="220498383"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/Issue%2079497/near/220498383" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> CraftSpider <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/Issue.2079497.html#220498383">(Dec 20 2020 at 02:21)</a>:</h4>
<p>For <a href="https://github.com/rust-lang/rust/issues/79497">#79497</a>, I know where the error is, but I'm not sure the best path to fix it. The actual error seems to be because refutable pattern checking isn't done yet, so an argument can have an invalid type. How should rustdoc handle that though? Panic is wrong, but I'm not sure how to change a <code>Clean&lt;Argument&gt;</code> impl into something that can fail</p>



<a name="220500555"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/Issue%2079497/near/220500555" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/Issue.2079497.html#220500555">(Dec 20 2020 at 03:34)</a>:</h4>
<p><span class="user-mention" data-user-id="319144">@Rune Tynan</span> I would make sure this is actually related to being refutable</p>



<a name="220500558"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/Issue%2079497/near/220500558" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/Issue.2079497.html#220500558">(Dec 20 2020 at 03:34)</a>:</h4>
<p>I suspect it would give the same error on <code>0_u8..=255</code></p>



<a name="220500967"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/Issue%2079497/near/220500967" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> CraftSpider <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/Issue.2079497.html#220500967">(Dec 20 2020 at 03:48)</a>:</h4>
<p>Right, true. Which, if that's valid, then the solution is just to teach rustdoc to handle ranges, and refutability doesn't come into it.</p>



<a name="220501162"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/Issue%2079497/near/220501162" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> CraftSpider <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/Issue.2079497.html#220501162">(Dec 20 2020 at 03:54)</a>:</h4>
<p>Honestly, I forgot/didn't know irrefutable ranges were valid function patterns, it's not something that tends to be used in 'normal' code. Gotta remember that function args really are basically just <code>Pattern: Type</code></p>



<a name="220501250"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/Issue%2079497/near/220501250" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/Issue.2079497.html#220501250">(Dec 20 2020 at 03:57)</a>:</h4>
<p>well, I'm not sure they <em>are</em> actually valid <span aria-label="laughing" class="emoji emoji-1f606" role="img" title="laughing">:laughing:</span></p>



<a name="220501252"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/Issue%2079497/near/220501252" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/Issue.2079497.html#220501252">(Dec 20 2020 at 03:57)</a>:</h4>
<p>but at least this should be an error and not an ICE</p>



<a name="220501255"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/Issue%2079497/near/220501255" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/Issue.2079497.html#220501255">(Dec 20 2020 at 03:57)</a>:</h4>
<p>I would double check by running rustc</p>



<a name="220501387"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/Issue%2079497/near/220501387" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> CraftSpider <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/Issue.2079497.html#220501387">(Dec 20 2020 at 04:01)</a>:</h4>
<p>I tried a <code>fn foo(0u8..=255: u8) {}</code>, and it did compile</p>



<a name="220501508"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/Issue%2079497/near/220501508" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/Issue.2079497.html#220501508">(Dec 20 2020 at 04:05)</a>:</h4>
<p>nice, and did rustdoc panic?</p>



<a name="220501610"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/Issue%2079497/near/220501610" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> CraftSpider <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/Issue.2079497.html#220501610">(Dec 20 2020 at 04:08)</a>:</h4>
<p>One minute and I'll tell you, though if it <em>doesn't</em> I'll be surprised :P</p>



<a name="220501624"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/Issue%2079497/near/220501624" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> CraftSpider <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/Issue.2079497.html#220501624">(Dec 20 2020 at 04:09)</a>:</h4>
<p>Yep, it does panic</p>



<a name="220501678"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/Issue%2079497/near/220501678" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> CraftSpider <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/Issue.2079497.html#220501678">(Dec 20 2020 at 04:10)</a>:</h4>
<p>From the same line, same message. A range can be irrefutable, but <code>name_from_pat</code> seems to have assumed it would never see it</p>



<a name="220501693"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/Issue%2079497/near/220501693" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> CraftSpider <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/Issue.2079497.html#220501693">(Dec 20 2020 at 04:11)</a>:</h4>
<p>The most technically correct solution I can think of is to actually render out the range. On the other hand, that would require work to render Expr nodes (Unless there's already a util function somewhere, I'll look for one). On the other hand, it's unlikely this is a very desired use-case, so could probably do something like with <code>Lit</code>, where it warns and returns a dummy value (Could make it just like "[range]" or "..=" or "()" with little effort)</p>



<a name="220501790"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/Issue%2079497/near/220501790" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/Issue.2079497.html#220501790">(Dec 20 2020 at 04:15)</a>:</h4>
<p>I think currently it just shows __arg0 if it can't come up with a reasonable name</p>



<a name="220501792"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/Issue%2079497/near/220501792" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/Issue.2079497.html#220501792">(Dec 20 2020 at 04:15)</a>:</h4>
<p>do you have a link to the code that's panicking?</p>



<a name="220501833"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/Issue%2079497/near/220501833" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> CraftSpider <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/Issue.2079497.html#220501833">(Dec 20 2020 at 04:16)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/blob/master/src/librustdoc/clean/utils.rs#L416">https://github.com/rust-lang/rust/blob/master/src/librustdoc/clean/utils.rs#L416</a></p>



<a name="220501849"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/Issue%2079497/near/220501849" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> CraftSpider <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/Issue.2079497.html#220501849">(Dec 20 2020 at 04:17)</a>:</h4>
<p>Called from <a href="https://github.com/rust-lang/rust/blob/master/src/librustdoc/clean/mod.rs#L956">https://github.com/rust-lang/rust/blob/master/src/librustdoc/clean/mod.rs#L956</a>, cleaning Arguments, called by cleaning a function definition</p>



<a name="220501850"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/Issue%2079497/near/220501850" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/Issue.2079497.html#220501850">(Dec 20 2020 at 04:17)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232545">Joshua Nelson</span> <a href="#narrow/stream/266220-rustdoc/topic/Issue.2079497/near/220501790">said</a>:</p>
<blockquote>
<p>I think currently it just shows __arg0 if it can't come up with a reasonable name</p>
</blockquote>
<p>cc <a href="https://github.com/rust-lang/rust/issues/76517">#76517</a></p>



<a name="220501903"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/Issue%2079497/near/220501903" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/Issue.2079497.html#220501903">(Dec 20 2020 at 04:19)</a>:</h4>
<p>ok it looks like this is handled by pretty-printing the pattern</p>



<a name="220501904"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/Issue%2079497/near/220501904" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/Issue.2079497.html#220501904">(Dec 20 2020 at 04:19)</a>:</h4>
<p>with custom code because of course it is <span aria-label="face palm" class="emoji emoji-1f926" role="img" title="face palm">:face_palm:</span></p>



<a name="220501944"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/Issue%2079497/near/220501944" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/Issue.2079497.html#220501944">(Dec 20 2020 at 04:20)</a>:</h4>
<p>so I think I would pretty-print the range and return that as the name</p>



<a name="220501948"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/Issue%2079497/near/220501948" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> CraftSpider <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/Issue.2079497.html#220501948">(Dec 20 2020 at 04:20)</a>:</h4>
<p>Alright. Is that a thing already in rustc I presume?</p>



<a name="220501951"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/Issue%2079497/near/220501951" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/Issue.2079497.html#220501951">(Dec 20 2020 at 04:20)</a>:</h4>
<p><span aria-label="shrug" class="emoji emoji-1f937" role="img" title="shrug">:shrug:</span> I'm not the one to ask, sorry</p>



<a name="220501952"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/Issue%2079497/near/220501952" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/Issue.2079497.html#220501952">(Dec 20 2020 at 04:21)</a>:</h4>
<p>maybe someone in <a class="stream" data-stream-id="182449" href="/#narrow/stream/182449-t-compiler.2Fhelp">#t-compiler/help</a> will know</p>



<a name="220502063"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/Issue%2079497/near/220502063" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> CraftSpider <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/Issue.2079497.html#220502063">(Dec 20 2020 at 04:24)</a>:</h4>
<p>Looking myself, just found rustc_hir_pretty, which looks to be the desired thing</p>



<a name="220502074"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/Issue%2079497/near/220502074" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/Issue.2079497.html#220502074">(Dec 20 2020 at 04:24)</a>:</h4>
<p>when you finish fixing this bug, it would be nice to fix the rest of that function to use hir_pretty too</p>



<a name="220502076"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/Issue%2079497/near/220502076" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/Issue.2079497.html#220502076">(Dec 20 2020 at 04:24)</a>:</h4>
<p>but no need to do both at once</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>